package com.sn.core.util;


import com.sn.core.emums.CodeEnum;

/**
 * Created by qingshengzheng on 18/5/7.
 */
public class EnumUtil {
    public static <T extends CodeEnum> T getByCode(Class<T> enumClass, String code) {
        for (T each : enumClass.getEnumConstants()) {
            if(each.getCode().equals(code)){
                return each;
            }
        }
        return null;
    }
}
